package com.googlecode.jmicroerp.wicket.administrare;

import com.googlecode.jmicroerp.service.ProgramLucruProvider;
import com.googlecode.jmicroerp.wicket.DefaultPageTemplate;
import net.ftlines.wicket.fullcalendar.Config;
import net.ftlines.wicket.fullcalendar.EventSource;
import net.ftlines.wicket.fullcalendar.FullCalendar;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.joda.time.LocalTime;

/**
 *
 * @author alex
 */
public class VizualizareProgramLucruPage extends DefaultPageTemplate {

    private static final long serialVersionUID = 1L;
    @SpringBean(name = "programLucruProvider")
    private ProgramLucruProvider programProvider;

    public VizualizareProgramLucruPage() {
        EventSource activitatiSource = new EventSource();
        activitatiSource.setTitle("Program de lucru");
        activitatiSource.setBackgroundColor("#000066");
        activitatiSource.setBorderColor("#000066");
        activitatiSource.setEventsProvider(programProvider);
        
        Config config = new Config();
        config.setSelectable(true);
        config.setSelectHelper(false);
        config.setTimeFormat("h:mm tt{ - h:mm tt}");
        
        config.setDefaultView("agendaWeek");
        config.setDisableDragging(Boolean.TRUE);
        config.setDisableResizing(Boolean.TRUE);
        config.setColumnFormatDay("dd.MM.yyyy");
        config.setColumnFormatWeek("dd.MM.yyyy");
        config.getHeader().setLeft("prev,next today");
        config.getHeader().setCenter("title");
        config.getHeader().setRight("month,agendaWeek,agendaDay");

        config.getButtonText().setDay("Zi");
        config.getButtonText().setMonth("Luna");
        config.getButtonText().setWeek("Saptamana");
        config.getButtonText().setToday("Astazi");

        config.setLoading("function(bool) { if (bool) $(\"#loading\").show(); else $(\"#loading\").hide(); }");

        config.setMinTime(new LocalTime(0, 0));
        config.setMaxTime(new LocalTime(23, 59));
        config.setAllDaySlot(true);
        
        FullCalendar fullCalendar = new FullCalendar("calendar", config);
        fullCalendar.setMarkupId("calendar");
        fullCalendar.setVisible(true);
        
        add(fullCalendar);
        
    }
}
